package org.groupg.filetodb.model.database;


import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;

import java.io.Serializable;

/**
 * 表示数据库表元数据
 */
public class Table implements Serializable {
    /**
     * 表目录（可能为null）
     */
    private String tableCat;
    /**
     * 表模式（可能为null）
     */
    private String tableSchem;
    /**
     * 表名
     */
    private String tableName;
    /**
     * 表类型（如 "TABLE", "VIEW"）
     */
    private String tableType;
    /**
     * 表备注
     */
    private String remarks;
    /**
     * 类型目录
     */
    private String typeCat;
    /**
     * 类型模式
     */
    private String typeSchem;
    /**
     * 类型名
     */
    private String typeName;
    /**
     * 自引用列名
     */
    private String selfReferencingColName;
    /**
     * 引用生成方式
     */
    private String refGeneration;

    public Table() {
    }

    public Table(String tableCat, String tableSchem, String tableName, String tableType, String remarks) {
        this.tableCat = tableCat;
        this.tableSchem = tableSchem;
        this.tableName = tableName;
        this.tableType = tableType;
        this.remarks = remarks;
    }

    public Table(String tableCat, String tableSchem, String tableName, String tableType, String remarks, String typeCat, String typeSchem, String typeName, String selfReferencingColName, String refGeneration) {
        this.tableCat = tableCat;
        this.tableSchem = tableSchem;
        this.tableName = tableName;
        this.tableType = tableType;
        this.remarks = remarks;
        this.typeCat = typeCat;
        this.typeSchem = typeSchem;
        this.typeName = typeName;
        this.selfReferencingColName = selfReferencingColName;
        this.refGeneration = refGeneration;
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("tableCat", tableCat)
                .add("tableSchem", tableSchem)
                .add("tableName", tableName)
                .add("tableType", tableType)
                .add("remarks", remarks)
                .add("typeCat", typeCat)
                .add("typeSchem", typeSchem)
                .add("typeName", typeName)
                .add("selfReferencingColName", selfReferencingColName)
                .add("refGeneration", refGeneration)
                .toString();
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        Table table = (Table) o;
        return Objects.equal(getTableCat(), table.getTableCat()) && Objects.equal(getTableSchem(), table.getTableSchem()) && Objects.equal(getTableName(), table.getTableName()) && Objects.equal(getTableType(), table.getTableType()) && Objects.equal(getRemarks(), table.getRemarks()) && Objects.equal(getTypeCat(), table.getTypeCat()) && Objects.equal(getTypeSchem(), table.getTypeSchem()) && Objects.equal(getTypeName(), table.getTypeName()) && Objects.equal(getSelfReferencingColName(), table.getSelfReferencingColName()) && Objects.equal(getRefGeneration(), table.getRefGeneration());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getTableCat(), getTableSchem(), getTableName(), getTableType(), getRemarks(), getTypeCat(), getTypeSchem(), getTypeName(), getSelfReferencingColName(), getRefGeneration());
    }

    public String getTableCat() {
        return tableCat;
    }

    public void setTableCat(String tableCat) {
        this.tableCat = tableCat;
    }

    public String getTableSchem() {
        return tableSchem;
    }

    public void setTableSchem(String tableSchem) {
        this.tableSchem = tableSchem;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getTableType() {
        return tableType;
    }

    public void setTableType(String tableType) {
        this.tableType = tableType;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public String getTypeCat() {
        return typeCat;
    }

    public void setTypeCat(String typeCat) {
        this.typeCat = typeCat;
    }

    public String getTypeSchem() {
        return typeSchem;
    }

    public void setTypeSchem(String typeSchem) {
        this.typeSchem = typeSchem;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public String getSelfReferencingColName() {
        return selfReferencingColName;
    }

    public void setSelfReferencingColName(String selfReferencingColName) {
        this.selfReferencingColName = selfReferencingColName;
    }

    public String getRefGeneration() {
        return refGeneration;
    }

    public void setRefGeneration(String refGeneration) {
        this.refGeneration = refGeneration;
    }

    // 省略getter/setter
}









